﻿using System;
using System.Data.Linq;
using LinqBll.util;
using LinqDll;

namespace LinqBll.Cores
{
    public class AwardUserCore : BaseCore<Activity_AwardUser>
    {
        public AwardUserCore(DataContext dataContext) : base(dataContext)
        {

        }


        /// <summary>
        ///     默认为null返回未开始
        /// </summary>
        /// <param name="cycleId"></param>
        /// <returns></returns>
        public static ActivityStatus GetCycleStatus(int cycleId)
        {
            Activity_Cycle cycle = GetCycle(cycleId);
            if (cycle != null)
            {
                if (DateTime.Now >= cycle.startDate && DateTime.Now <= cycle.endDate)
                    return ActivityStatus.Jinxingzhong;
                if (DateTime.Now <= cycle.startDate)
                    return ActivityStatus.WeiKaishi;
                if (DateTime.Now >= cycle.endDate)
                    return ActivityStatus.Jiesu;
            }
            return ActivityStatus.WeiKaishi;
        }
    }
}